<template>
  <div class="container">
    <van-sticky :offset-top="0">
      <van-nav-bar
        left-text="返回"
        title="资讯分类"
        left-arrow
        @click-left="back"
      />
    </van-sticky>
    <van-card
      v-for="item in zixun"
      :key="item.id"
      :desc="item.desc"
      :title="item.name"
      :thumb="item.coverImage | dalImg"
      :thumb-link="'/#/zixuncategroy?id=' + item.id"
    >
      <template #bottom>
        <van-tag plain type="danger">{{
          $moment(item.createdAt).format("YYYY-MM-DD")
        }}</van-tag>
      </template>
      <template #footer>
        <van-tag plain type="danger">浏览量{{ amount }}</van-tag>
      </template>
    </van-card>
  </div>
</template>

<script>
import { loadarticle_categories } from "../services/zixun";
export default {
  data() {
    return {
      zixun: [],
    };
  },
  async created() {
    const res = await loadarticle_categories();
    console.log(res.data);
    this.zixun = res.data;
    this.amount = Math.floor(Math.random() * 100);
  },
  methods: {
    back() {
      window.history.go(-1);
    },
  },
};
</script>

<style>
</style>